import 'package:flutter/material.dart';

class RowCentered extends StatelessWidget {
  final List<Widget>? leftChild;
  final List<Widget>? rightChild;
  final Widget child;

  const RowCentered(
      {Key? key, this.leftChild, this.rightChild, required this.child})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        leftChild == null
            ? const Spacer()
            : Expanded(
                child: Align(
                  alignment: Alignment.centerLeft,
                  child: Row(
                    mainAxisSize: MainAxisSize.min,
                    children: leftChild!,
                  ),
                ),
              ),
        child,
        rightChild == null
            ? const Spacer()
            : Expanded(
                child: Align(
                  alignment: Alignment.centerRight,
                  child: Row(
                    mainAxisSize: MainAxisSize.min,
                    children: rightChild!,
                  ),
                ),
              ),
      ],
    );
  }
}
